package com.example.xm.presenter.own;

import com.example.xm.base.BasePresenter;
import com.example.xm.bean.OwnBean.UserUpdateBean;
import com.example.xm.common.CommonSubScriBer;
import com.example.xm.interfaces.IBasePresenter;
import com.example.xm.interfaces.IBaseView;
import com.example.xm.interfaces.own.IOwn;
import com.example.xm.model.HttpManager;
import com.example.xm.utiles.RxUtils;

import java.util.Map;

public class OwnPresenter extends BasePresenter<IOwn.View> implements IOwn.Presenter {
    @Override
    public void updateUserInfo(String token,Map<String, String> map) {
        addSubscribe(
                HttpManager
                        .getInstance()
                        .getUserApi()
                        .updateUserInfo(token,map)
                        .compose(RxUtils.rxScheduler())
                        .subscribeWith(new CommonSubScriBer<UserUpdateBean>(mView) {
                            @Override
                            public void onNext(UserUpdateBean userUpdateBean) {
                                mView.updateUserInfoReturn(userUpdateBean);
                            }
                        })
        );
    }
}
